<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js日常使用小实例的封装</title>
</head>
<body>
    


    <script src="../js_plugins/common_use.js"></script>
    <script>
        var trimStr = "   123   456  789  ";
        console.log("原形："+trimStr +'!');

        console.log('---------去除空格---------');
        //去除前空格
        console.log("去除前空格:"+ecDo.trim(trimStr,3)+'!');

        //去除后空格
        console.log("去除后空格:"+ecDo.trim(trimStr,4)+'!');

        //去除前后空格
        console.log("去除前后空格:"+ecDo.trim(trimStr,2)+'!');

        //去除所有空格
        console.log("去除所有空格:"+ecDo.trim(trimStr,1)+'!');


        console.log('----------英文单词大小写------');
        var changeCaseStr = "Chen yan qiu";
        console.log("原形："+trimStr +'!');
        
        //首字母大写
        console.log("首字母大写，其他小写:"+ecDo.changeCase(changeCaseStr,1)+'!');

        console.log("首字母小写，其他大写:"+ecDo.changeCase(changeCaseStr,2)+'!');

        console.log("大小写转换:"+ecDo.changeCase(changeCaseStr,3)+'!');

        console.log("全部大写:"+ecDo.changeCase(changeCaseStr,4)+'!');

        console.log("全部小写:"+ecDo.changeCase(changeCaseStr,5)+'!');

        console.log('----------字符串循环复制------');
        var repeatStrs = "复制词组";

        console.log("赋值2次："+ecDo.repeatStr(repeatStrs,2));


        console.log('----------字符串替换------');
        var replaceStr = "这是 福建省 三明市";
        console.log('原句：'+replaceStr);

        console.log('替换后的句子：'+ecDo.replaceAll(replaceStr,"三明","厦门"));

        console.log('----------字符替换*------');
        var replaceStr1 = "字符替换*:这是手机号码：18797547850";
        console.log('原句：'+replaceStr1);

        console.log('regArr.length === 3&&type===0的结果：'+ecDo.replaceStr(replaceStr1,[3,5,3],0));

        console.log('regArr.length === 3&&type===1的结果：'+ecDo.replaceStr(replaceStr1,[3,5,3],1));

        console.log('regArr.length === 1 && type===0的结果：'+ecDo.replaceStr('replaceStr1',[5],0));


        console.log('regArr.length === 1&&type===1的结果：'+ecDo.replaceStr(replaceStr1,[5],1));

        console.log('----------检测字符串------');
        console.log('email：'+ ecDo.checkType('1@163.com','email'));
        console.log('email：'+ ecDo.checkType('1163.com','email'));

        console.log('phone：'+ ecDo.checkType('18797547850','phone'));
        console.log('phone：'+ ecDo.checkType('1879754785','phone'));

        console.log('tel：'+ ecDo.checkType('0598-7307150','tel'));
        console.log('tel：'+ ecDo.checkType('7307150','tel'));

        console.log('number：'+ ecDo.checkType(1,'number'));
        console.log('number：'+ ecDo.checkType('aaa','number'));

        console.log('english：'+ ecDo.checkType('englist','english'));
        console.log('english：'+ ecDo.checkType('中文','english'));

        console.log('chinese：'+ ecDo.checkType('englist','chinese'));
        console.log('chinese：'+ ecDo.checkType('中文','chinese'));

        console.log('text：'+ ecDo.checkType('englist123','text'));
        console.log('text：'+ ecDo.checkType('中文aaaa','text'));

        console.log('lower：'+ ecDo.checkType('English','lower'));
        console.log('lower：'+ ecDo.checkType('english','lower'));

        console.log('upper：'+ ecDo.checkType('ENGLISH','upper'));
        console.log('upper：'+ ecDo.checkType('english','upper'));

        console.log('----------检测密码强度------');

        console.log('长度小于6的密码强度：'+ecDo.checkPwd('12345'));

        console.log('长度大于等于6的密码强度：'+ecDo.checkPwd('123456')); //强度：0

        console.log('长度大于等于6 && 全是数字的密码强度：'+ecDo.checkPwd('123456')); //强度：1

        console.log('长度大于等于6 && 全是小写字母的密码强度：'+ecDo.checkPwd('chenyanqiu')); //强度：1

        console.log('长度大于等于6 && 全是大写字母的密码强度：'+ecDo.checkPwd('CHENYANQIU')); //强度：1

        console.log('长度大于等于6 && 全是大写字母的密码强度：'+ecDo.checkPwd('CHENYANQIU')); //强度：1

        console.log('长度大于等于6 && 有特殊字符的密码强度：'+ecDo.checkPwd('CHEN__YA.NQIU')); //强度：2

         console.log('长度大于等于6 && 混合的密码强度：'+ecDo.checkPwd('123chen.__')); //强度：3



         console.log('----------随机码------');

         console.log('随机码——二进制：'+ ecDo.randomWord(2));

         console.log('随机码——八进制：'+ ecDo.randomWord(8));

         console.log('随机码——十进制：'+ ecDo.randomWord(10));

         console.log('随机码——十六进制：'+ ecDo.randomWord(16));

         console.log('随机码——三十二进制：'+ ecDo.randomWord(32));

         console.log('随机码——十二进制：'+ ecDo.randomWord(12));



         console.log('----------查找字符串------');
         console.log(ecDo.countStr('chenyanqiuhahahhahahhahahha','yan'));

         console.log(ecDo.countStr('chenyanqiuhahahhahahhahahha','hehe'));


         console.log('----------过滤字符串(html标签，表情，特殊字符)------');

         var filterStr = 'asd    654a大蠢sasdasdASDQWEXZC6d5#%^*^&*^%^&*$\\"\'#@!()*/-())_\'":"{}?<div></div><img src=""/>啊实打实大蠢猪自行车这些课程';

         console.log('替换掉特殊字符串special：' + ecDo.filterStr(filterStr,'special'));

         console.log('替换掉特殊字符串special，用“#”号替换：' + ecDo.filterStr(filterStr,'special',"#"));

         console.log('替换掉特殊字符串special，用“#”号替换，并且不替换“*”号：' + ecDo.filterStr(filterStr,'special',"#","*"));

         console.log('替换掉html标签：' + ecDo.filterStr(filterStr,'html'));

         console.log('替换掉emjoy表情包：' + ecDo.filterStr(filterStr,'emjoy'));

         console.log('替换掉word小写单词：' + ecDo.filterStr(filterStr,'word',"小写"));

         console.log('替换掉WORD大写单词：' + ecDo.filterStr(filterStr,'WORD',"大写"));

         console.log('替换掉number：' + ecDo.filterStr(filterStr,'number',"数字"));

         console.log('替换掉chinese中文：' + ecDo.filterStr(filterStr,'chinese',"中文"));


         console.log('----------格式化处理字符串------');

         var formatStr = "1234asda567asd890a";
         console.log('格式化字符串：'+ecDo.formatText(formatStr));

         console.log('格式化字符串，长度为5，以空格分割：'+ecDo.formatText(formatStr,5,' '));


         console.log('----------找出最长单词------');

         var maxLongerStr = "this is long longer wrod";
         console.log("原句："+maxLongerStr);
         var longesObj = ecDo.longestWord(maxLongerStr);
         console.log("最长的单词"+ longesObj.el+"; 最长单词的长度："+longesObj.max);


         console.log('----------句中单词首字母大写------');

         var str2 = "this is a page";
         console.log('原句：'+str2);

         console.log('句中首字母大写：'+ecDo.titleCaseUp(str2));



         

    </script>
</body>
</html>